<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<title>coarsendoc</title><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>

<style type="text/css">
/* Overrides of notebook CSS for static HTML export */
body {
  overflow: visible;
  padding: 8px;
}
div#notebook {
  overflow: visible;
  border-top: none;
}@media print {
  div.cell {
    display: block;
    page-break-inside: avoid;
  } 
  div.output_wrapper { 
    display: block;
    page-break-inside: avoid; 
  }
  div.output { 
    display: block;
    page-break-inside: avoid; 
  }
}
</style>

<!-- Custom stylesheet, it must be in the parent directory as the html file -->
<link rel="stylesheet" type="text/css" media="all" href="../doc.css" />
<link rel="stylesheet" type="text/css" media="all" href="doc.css" />

<!-- Loading mathjax macro -->
<!-- Load mathjax -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML"></script>
    <!-- MathJax configuration -->
    <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
        tex2jax: {
            inlineMath: [ ['$','$'], ["\\(","\\)"] ],
            displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
            processEscapes: true,
            processEnvironments: true
        },
        // Center justify equations in code and markdown cells. Elsewhere
        // we use CSS to left justify single line equations in code cells.
        displayAlign: 'center',
        "HTML-CSS": {
            styles: {'.MathJax_Display': {"margin": 0}},
            linebreaks: { automatic: true }
        }
    });
    </script>
    <!-- End of mathjax configuration --></head>
<body>
  <div tabindex="-1" id="notebook" class="border-box-sizing">
    <div class="container" id="notebook-container">

<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="Coarsen-in-Two-Dimensions">Coarsen in Two Dimensions<a class="anchor-link" href="#Coarsen-in-Two-Dimensions">&#182;</a></h1><p>We describe the coarsening algorithm implemented in <code>coarsen.m</code> for two dimensional bisection grids. We assume when bisecting a triangle, the left child is stored in a prori of the right child. More details can be found in the paper,</p>
<ul>
<li>L. Chen and C-S. Zhang. <a href="http://math.uci.edu/~chenlong/CZ2007.html">A coarsening algorithm on adaptive grids by newest vertex bisection and its applications</a>. <em>Journal of Computational Mathematics</em>, 28(6):767-789, 2010.</li>
</ul>

</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Compatible-Bisection">Compatible Bisection<a class="anchor-link" href="#Compatible-Bisection">&#182;</a></h2><p>Every bisection grids can be obtained from an initial grid with a
sequence of compatible bisections. In two dimensions, there are two types
of compatible bisections.</p>
<ul>
<li>Case 1: A pair of triangles are divided into four triangles by adding the middle point their common edge.</li>
</ul>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[1]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-matlab"><pre><span></span><span class="n">node</span> <span class="p">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">;</span> <span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">;</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">;</span> <span class="mi">0</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">];</span>
<span class="n">elem</span> <span class="p">=</span> <span class="p">[</span><span class="mi">2</span> <span class="mi">3</span> <span class="mi">1</span><span class="p">;</span> <span class="mi">4</span> <span class="mi">1</span> <span class="mi">3</span><span class="p">];</span>
<span class="n">figure</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span> 
<span class="n">subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span> <span class="n">showmesh</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">);</span>
<span class="p">[</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">]</span> <span class="p">=</span> <span class="n">bisect</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">,[</span><span class="mi">1</span> <span class="mi">2</span><span class="p">]);</span>
<span class="n">subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span> <span class="n">showmesh</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">);</span> 
<span class="n">findnode</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="s">&#39;noindex&#39;</span><span class="p">);</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">

<div class="prompt"></div>




<div class="output_png output_subarea ">
<img src="
B3RJTUUH4QgJBgcVeqVoUgAAACR0RVh0U29mdHdhcmUATUFUTEFCLCBUaGUgTWF0aFdvcmtzLCBJ
bmMuPFjdGAAAACJ0RVh0Q3JlYXRpb24gVGltZQAwOS1BdWctMjAxNyAxNDowNzoyMVeWFJ0AABAN
SURBVHic7do/q6XXecbhZ0I6g1Eb8MCeLuBA5MZmVJhRp26iRukk9AlikL6Aepv4G4i4D7Y6g4tR
ZWFV+QgbJkXKYcClmRTHHB+fP/vsP+/7rnutdV3V4VSreG5+e8+cJ+/evSsAaO0fWj8AAKoECYAQ
ggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIA
EQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAIggRABEECIIIgARBBkACIIEgARBAk
ACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiABEEGQAIgg
SABEECQAIggSABEECYAIggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQ
QZAAiC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MlSHt9/sPP/ywqtSoR4IEDGW/31fVbrdr/A5OJ0gARPBHDQBEECQAIggS
ABEECYAIggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQ
JAAiCBIAEQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAIggRABEECIIIgARBBkACI
IEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiAB
EEGQAIggSABEECQAIggSABEECYAIggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARB
AiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAI
ggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIA
EQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAIggRABEECIIIgARBBkACIIEgARBAk
ACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiABEEGQAIgg
SABE+H9E4Z5dq2WzpAAAAABJRU5ErkJggg==
"
>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<ul>
<li>Case 2: A triangle containing a boundary edge is divided into two triangles by adding the middle point the boundary edge.</li>
</ul>
<p>The nodes added by compatible bisections are called good-to-carsen nodes
or simpley <em>good</em> nodes.</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[4]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-matlab"><pre><span></span><span class="n">elem</span> <span class="p">=</span> <span class="p">[</span><span class="mi">2</span> <span class="mi">3</span> <span class="mi">1</span><span class="p">];</span>
<span class="n">subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span> <span class="n">showmesh</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">);</span>
<span class="p">[</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">]</span> <span class="p">=</span> <span class="n">bisect</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span>
<span class="n">subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span> <span class="n">showmesh</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">);</span> 
<span class="n">findnode</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="s">&#39;noindex&#39;</span><span class="p">);</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">

<div class="prompt"></div>




<div class="output_png output_subarea ">
<img src="
B3RJTUUH4QgJBgoAotby9AAAACR0RVh0U29mdHdhcmUATUFUTEFCLCBUaGUgTWF0aFdvcmtzLCBJ
bmMuPFjdGAAAACJ0RVh0Q3JlYXRpb24gVGltZQAwOS1BdWctMjAxNyAxNDoxMDowMLIQV4AAAAvF
SURBVHic7dm9jhxZAYbhGiBDWCPiHdEdgTYBEpA3QLYQYjMvCeFi7sASRCS2cxB7ByuRESC02SZo
JrMgIoSs0XABgyXiITir2aE9Pz3d9fOdc54n6uroC6r09qk+ury8HABgaV9ZegAADIMgARBCkACI
IEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiAB
EEGQAIggSABEECQAIggSABEECYAIggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARB
AiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAI
ggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIA
EQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAIggRABEECIIIgARBBkACIIEgARBAk
ACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiABEEGQAIgg
SABEECQAIggSABEECYAIggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQ
QZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAIggRABEEC
IIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiC
BEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAIggRABEECIIIgARBBkACIIEgARBAkACIIEgAR
BAmACIIEQARBAiCCIAEQQZCApmw2m6UnsCdB6svZ2dl6vX79+vXSQ2ASm81mvV6v12tZqpEgdeTs
7OyXv/n4oz/+5Oyff9Ek2rPZbL7/o++uHp8c/+DrP/v4mSZVR5B6UWr0/E8/Pz559L0X39EkGlNq
9NHvP1x98N7xyaMnv/2hJlVHkLpwVaNyqUk05lqNTso3mlQjQWrfVo0KTaIZ79ao0KTqCFLjbqxR
oUk04LYaFZpUF0Fq2R01KjSJqt1do0KTKiJIzbq3RoUmUaldalRoUi0EqU071qjQJKqze40KTaqC
IDXoQTUqNImKPLRGhSblE6TW7FGjQpOown41KjQpnCA1Ze8aFZpEuENqVGhSMkFqx4E1KjSJWIfX
qNCkWILUiFFqVGgSgcaqUaFJmQSpBSPWqNAkooxbo0KTAglS9UavUaFJhJiiRoUmpRGkuk1Uo0KT
WNx0NSo0KYogVWzSGhWaxIKmrlGhSTkEqVYz1KjQJBYxT40KTQohSFWarUaFJjGzOWtUaFICQarP
zDUqNInZzF+jQpMWJ0iVWaRGh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U2T7qVGtWu7SYL0JTVqgCbdQY3a0HCTBOkLatQMTbqRGrWk1SYJ0jCoUXM0aYsatafJ
JgmSGrVJk66oUavaa1LvQVKjhmnSoEata6xJXQdJjZrXeZPUqActNanfIKlRJ7ptkhr1o5kmdRok
NepKh01So9600aQeg6RGHeqqSWrUpwaa1F2Q1KhbnTRJjXpWe5P6CpIada75JqkRVTepoyCpEUPT
TVIjinqb1EuQ1IgrTTZJjbiu0iZ1ESQ1YktjTVIj3lVjk9oPkhpxo2aapEZbVksPyFFdk44uLy+X
3jAhNeJuF+dv//7JP558+8cvX75cess+1Oi64/O3z158vnpzPgzD5vHJZ598eHHyaOlRy7s4f3v2
67/++Q+frVarpbfco+UTkhpxr6rPSWq05apGwzCs3pw/e/H5sntCVHROavaEtNls1uv16rEHlftd
/Ps/x1/95unpaf5PyOuOjo5Wj09WH7y39JAUp797s/XN0189XmRJoIvztxd/+2/4Tf61pQdMZbVa
nZ6eLr2CmiQ/qDd69erV0hOCfGsYhmE7SL/4xk//tcCWSO8Pw/vpN3mzJySgO0+fDmdnX14+eTL4
VVqVlv9DAvry6afD8+dffFajCjkhAW3ZbIbsF1PcRpAAiOCVHQARBAmACIIEQARBAiCCIAEQQZAA
iCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAIggRABEECIIIg
ARBBkACIIEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAE
QQIggiABEEGQAIggSABEECQAIggSABEECYAIggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmA
CIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggS
ABEECYAIggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQ
JAAiCBIAEQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAIggRABEECIIIgARBBkACI
IEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiAB
EEGQAIggSABEECQAIggSABEECYAIggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARB
AiCCIAEQQZAAiCBIAEQQJAAiCBIAEQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAI
ggRABEECIIIgARBBkACIIEgARBAkACIIEgARBAmACIIEQARBAiCCIAEQQZAAiCBIAEQQJAAiCBIA
EQQJgAiCBEAEQQIggiABEEGQAIggSABEECQAIggSABEECYAIggRABEECIIIgARDhfwQFVkMYm57C
AAAAAElFTkSuQmCC
"
>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Coarsening-Procedure">Coarsening Procedure<a class="anchor-link" href="#Coarsening-Procedure">&#182;</a></h2><p>Our coarsening algorithm consists of finding good nodes and removing
them. The coarsening procedure is illustrated by the following figures.</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[12]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-matlab"><pre><span></span><span class="n">load</span> <span class="n">Lshapemesh</span>
<span class="n">figure</span>
<span class="k">for</span> <span class="n">k</span> <span class="p">=</span> <span class="mi">1</span><span class="p">:</span><span class="mi">3</span>
    <span class="n">subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="n">k</span><span class="p">);</span> <span class="n">showmesh</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">);</span>
    <span class="p">[</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">]</span> <span class="p">=</span> <span class="n">coarsen</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">,</span><span class="s">&#39;all&#39;</span><span class="p">);</span>
<span class="k">end</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">

<div class="prompt"></div>




<div class="output_png output_subarea ">
<img src="
B3RJTUUH4QgJBxE2xZjGwAAAACR0RVh0U29mdHdhcmUATUFUTEFCLCBUaGUgTWF0aFdvcmtzLCBJ
bmMuPFjdGAAAACJ0RVh0Q3JlYXRpb24gVGltZQAwOS1BdWctMjAxNyAxNToxNzo1NPOqVNEAAB2z
SURBVHic7d0xj+PImcbx8p2BnUhicoZxEAElBxirDRq4YE9KLEeesIGZ1aaLAzbvQX+A6fkAfdv5
Jh1eC2ugL+vMmkSCo1OiwwY2IIAKDEdsRXa0F9QMRyuJZBVZRb4k/7/AWC+4b1N6q+tpUWTVL376
6ScFAEDd/qnuEwAAQCkCCQAgBIEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAg
AoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAA
ACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQC
CQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBE
IJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIA
QAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAg
AQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAI
BBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIA
iEAgAQBEIJAA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EIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBE
IJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIA
QAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAg
AQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAI
BBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIA
iEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgk
AIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCB
QAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAA
EQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEE
ABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQ
SAAAEQgkAIAIBBIAQAQCCQAgAoEEABCBQAIAiEAgAQBEIJAAACIQSAAAEQgkAIAIBBIAQAQCCQAg
AoEEABCBQAIAiEAgAQBEIJAAACL8P8HXhoN3STalAAAAAElFTkSuQmCC
"
>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Step-1----Find-Good-Nodes">Step 1 -- Find Good Nodes<a class="anchor-link" href="#Step-1----Find-Good-Nodes">&#182;</a></h2><p>We use the following characterization to find a good node p</p>
<ul>
<li>The valence of p is 4 (interior node) or 2 (boundary node).</li>
<li>It is the newest vertex of all triangles in its nodal star.</li>
</ul>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[15]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-matlab"><pre><span></span><span class="n">load</span> <span class="n">Lshapemesh</span>
<span class="n">N</span> <span class="p">=</span> <span class="nb">size</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span> 
<span class="n">NT</span> <span class="p">=</span> <span class="nb">size</span><span class="p">(</span><span class="n">elem</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span>
<span class="n">valence</span> <span class="p">=</span> <span class="nb">accumarray</span><span class="p">(</span><span class="n">elem</span><span class="p">(:),</span><span class="nb">ones</span><span class="p">(</span><span class="mi">3</span><span class="o">*</span><span class="n">NT</span><span class="p">,</span><span class="mi">1</span><span class="p">),[</span><span class="n">N</span> <span class="mi">1</span><span class="p">]);</span>
<span class="n">valenceNew</span> <span class="p">=</span> <span class="nb">accumarray</span><span class="p">(</span><span class="n">elem</span><span class="p">(:,</span><span class="mi">1</span><span class="p">),</span><span class="nb">ones</span><span class="p">(</span><span class="n">NT</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> <span class="p">[</span><span class="n">N</span> <span class="mi">1</span><span class="p">]);</span> <span class="c">% for newest vertex only</span>
<span class="n">allNodes</span> <span class="p">=</span> <span class="p">(</span><span class="mi">1</span><span class="p">:</span><span class="n">N</span><span class="p">)</span><span class="o">&#39;</span><span class="p">;</span>
<span class="n">intGoodNode</span> <span class="p">=</span> <span class="n">allNodes</span><span class="p">((</span><span class="n">valence</span><span class="o">==</span><span class="n">valenceNew</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">valence</span><span class="o">==</span><span class="mi">4</span><span class="p">));</span>
<span class="n">bdGoodNode</span> <span class="p">=</span> <span class="n">allNodes</span><span class="p">((</span><span class="n">valence</span><span class="o">==</span><span class="n">valenceNew</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">valence</span><span class="o">==</span><span class="mi">2</span><span class="p">));</span>
<span class="n">figure</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span> <span class="n">showmesh</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="n">elem</span><span class="p">);</span>
<span class="n">findnode</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="n">intGoodNode</span><span class="p">,</span><span class="s">&#39;noindex&#39;</span><span class="p">);</span>
<span class="n">findnode</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="n">bdGoodNode</span><span class="p">,</span><span class="s">&#39;noindex&#39;</span><span class="p">);</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">

<div class="prompt"></div>




<div class="output_png output_subarea ">
<img src="
B3RJTUUH4QgJBxsJiREDdwAAACR0RVh0U29mdHdhcmUATUFUTEFCLCBUaGUgTWF0aFdvcmtzLCBJ
bmMuPFjdGAAAACJ0RVh0Q3JlYXRpb24gVGltZQAwOS1BdWctMjAxNyAxNToyNzowObfMpvkAACAA
SURBVHic7d09bxtZloDh0qJjquKFCuDGWmC5kUElZjbKWgN76bDdWDg2e/kD3P0DCMuxg7FDE26M
nCkbOiHhjEEz56CEiSn+AW1wbDatD7I+7se5t94nc2MkXssevi7WrXMPbm5uEgAAfPs33wsAACBJ
CBIAQAmCBABQgSABAFQgSAAAFQgSAEAFggQAUIEgAQBUIEgAABUIEgBABYIEAFCBIAEAVCBIAAAV
CBIAQAWCBABQgSABAFQgSAAAFQgSAEAFggQAUIEgAQBUIEgAABUIEgBABYIEAFCBIAEAVCBIAAAV
CBIAQAWCBABQgSABAFQgSAAAFX7wvYD4TSaTz58/+14FAG8eP37c6/V8ryIABzc3N77XELmDg4M0
a3X6x74X4scqX8/Hi8b+BOS3nyRJp3+cZi3fy/F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sb3GiI3mUw+f/7sexXw6dWrV76X
AASAIAEAVOAeEgBABYIEAFCBIAEAVCBIAAAVCBIAQAWCBABQgSABAFQgSAAAFQgSAEAFggQAUIEg
AQBUIEgAABUIEgBABYIEAFCBIAEAVCBIAAAVCBIAQAWCBABQgSABAFQgSAAAFQgSAEAFggQAUIEg
AQBUIEgAABUIEgBABYIEAFCBIAEAVCBIAAAVCBIAQAWCBABQgSABAFQgSAAAFQgSAEAFggQAUIEg
AQBUIEgAABUIEgBABYIEAFCBIAEAVCBIAAAVCBIAQAWCBABQgSABAFQgSAAAFf4faCHcJcIKEtMA
AAAASUVORK5CYII=
"
>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Step-2----Remove-Good-Nodes">Step 2 -- Remove Good Nodes<a class="anchor-link" href="#Step-2----Remove-Good-Nodes">&#182;</a></h2><p>The star of good nodes are found using the incides matrix between
triangles and vertices.</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[16]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-matlab"><pre><span></span><span class="n">t2v</span> <span class="p">=</span> <span class="n">sparse</span><span class="p">([</span><span class="mi">1</span><span class="p">:</span><span class="n">NT</span><span class="p">,</span><span class="mi">1</span><span class="p">:</span><span class="n">NT</span><span class="p">,</span><span class="mi">1</span><span class="p">:</span><span class="n">NT</span><span class="p">],</span> <span class="n">elem</span><span class="p">(</span><span class="mi">1</span><span class="p">:</span><span class="n">NT</span><span class="p">,:),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">NT</span><span class="p">,</span> <span class="n">N</span><span class="p">);</span>
<span class="p">[</span><span class="n">ii</span><span class="p">,</span><span class="n">jj</span><span class="p">]</span> <span class="p">=</span> <span class="nb">find</span><span class="p">(</span><span class="n">t2v</span><span class="p">(:,</span><span class="n">intGoodNode</span><span class="p">));</span>
<span class="n">nodeStar</span> <span class="p">=</span> <span class="nb">reshape</span><span class="p">(</span><span class="n">ii</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="nb">length</span><span class="p">(</span><span class="n">intGoodNode</span><span class="p">));</span>
</pre></div>

</div>
</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>For interior good nodes, there are 3 configurations of 4 triangles in the
star of a good node showing the following figures. Other combinations are
ruled out by our ordering assumption: the left child is stored in a prori
of the right child. Therefe <code>nodeStar(:,1)</code> is always in L type and
<code>nodeStar(:,4)</code> is in R type. Here the oritentation is respect the
direction from the new added vertex to the opposite vertex in each
triangle.</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[18]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-matlab"><pre><span></span><span class="n">figure</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
<span class="n">node1</span> <span class="p">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">;</span> <span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">;</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">;</span> <span class="mi">0</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">;</span> <span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">];</span>
<span class="n">elem1</span> <span class="p">=</span> <span class="p">[</span><span class="mi">5</span> <span class="mi">3</span> <span class="mi">2</span><span class="p">;</span> <span class="mi">5</span> <span class="mi">1</span> <span class="mi">2</span><span class="p">;</span> <span class="mi">5</span> <span class="mi">4</span> <span class="mi">1</span><span class="p">;</span> <span class="mi">5</span> <span class="mi">3</span> <span class="mi">4</span><span class="p">];</span>
<span class="n">subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span> <span class="n">showmesh</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="n">elem1</span><span class="p">);</span> <span class="n">findelem</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="n">elem1</span><span class="p">);</span>
<span class="n">findnode</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="s">&#39;noindex&#39;</span><span class="p">);</span>
<span class="n">elem1</span> <span class="p">=</span> <span class="p">[</span><span class="mi">5</span> <span class="mi">3</span> <span class="mi">2</span><span class="p">;</span> <span class="mi">5</span> <span class="mi">4</span> <span class="mi">1</span><span class="p">;</span> <span class="mi">5</span> <span class="mi">1</span> <span class="mi">2</span><span class="p">;</span> <span class="mi">5</span> <span class="mi">3</span> <span class="mi">4</span><span class="p">];</span>
<span class="n">subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span> <span class="n">showmesh</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="n">elem1</span><span class="p">);</span> <span class="n">findelem</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="n">elem1</span><span class="p">);</span>
<span class="n">findnode</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="s">&#39;noindex&#39;</span><span class="p">);</span>
<span class="n">elem1</span> <span class="p">=</span> <span class="p">[</span><span class="mi">5</span> <span class="mi">3</span> <span class="mi">2</span><span class="p">;</span> <span class="mi">5</span> <span class="mi">4</span> <span class="mi">1</span><span class="p">;</span> <span class="mi">5</span> <span class="mi">3</span> <span class="mi">4</span><span class="p">;</span> <span class="mi">5</span> <span class="mi">1</span> <span class="mi">2</span><span class="p">];</span>
<span class="n">subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">3</span><span class="p">);</span> <span class="n">showmesh</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="n">elem1</span><span class="p">);</span> <span class="n">findelem</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="n">elem1</span><span class="p">);</span>
<span class="n">findnode</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="s">&#39;noindex&#39;</span><span class="p">)</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">

<div class="prompt"></div>




<div class="output_png output_subarea ">
<img src="
B3RJTUUH4QgJBygkOKU6MgAAACR0RVh0U29mdHdhcmUATUFUTEFCLCBUaGUgTWF0aFdvcmtzLCBJ
bmMuPFjdGAAAACJ0RVh0Q3JlYXRpb24gVGltZQAwOS1BdWctMjAxNyAxNTo0MDozNh7JJbIAAB+1
SURBVHic7d1vbFt3vcfxT9qyFQ0lXrUxKDU42i4a5HJvhsRGotE/gytaQGxVp1Ri05ZIDGnSQEWF
B6gPmiJR8adl3aTxgDGaoj1ZtHV3F6ntVCAJV2toQVDGOlVo084wUMSk4SYU7iBZ7oNjXMexj3/H
Pn++x36/1Aet5/jr5fPN+Zw4jt2ztLQkAADStirtOwAAgEQhAQCMoJAAACZQSAAAEygkAIAJFBIA
wAQKCQBgAoUEADCBQgIAmEAhAQBMoJAAACZQSAAAEygkAIAJFBIAwAQKCQBgAoUEADCBQgIAmEAh
AQBMoJAAACZQSAAAEygkAIAJFBIAwAQKCQBgAoUEADCBQgIAmEAhAQBMoJAAACZQSAAAEygkAIAJ
FBIAwAQKCQBgAoUEADCBQgIAmEAhAQBMoJAAACZQSAAAEygkAIAJFBIAwAQKCQBgAoUEADCBQgIA
mEAhAQBMoJAAACZQSAAAEygkAIAJFBIAwAQKCQBgAoUEADCBQgIAmEAhAQBMoJAAACZQSAAAEygk
AIAJFBIAwAQKCQBgAoUEADCBQgIAmEAhAQBMoJAAACZQSAAAEygkAIAJFBIAwA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B
AEygkAAAJlBIAAATKCQAgAkUEgDABAoJAGAChQQAMIFCAgCYQCEBAEygkAAAJlBIAAATKCQAgAkU
EgDABAoJAGAChQQAMIFCAgCYQCEBAEygkAAAJlBIAAATKCQAgAkUEgDABAoJAGAChQQAMIFCAgCY
QCEBAEygkAAAJlBIAAATKCQAgAkUEgDABAoJAGAChQQAMIFCAgCYQCEBAEygkAAAJlBIAAATKCQA
gAkUEgDABAoJAGAChQQAMIFCAgCYQCEBAEygkAAAJlBIAAATKCQAgAkUEgDABAoJAGAChQQAMIFC
AgCYQCEBAEygkAAAJlBIAAATKCQAgAkUEgDABAoJAGAChQQAMIFCAgCYQCEBAEygkAAAJlBIAAAT
KCQAgAkUEgDABAoJAGAChQQAMIFCAgCYQCEBAEygkAAAJlBIAAATKCQAgAkUEgDABAoJAGAChQQA
MIFCAgCYQCEBAEygkAAAJlBIAAAT/h8JtkOhtZENsQAAAABJRU5ErkJggg==
"
>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[19]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-matlab"><pre><span></span><span class="c">% We switch the local indices of nodal star to the first case. </span>
<span class="n">ix</span> <span class="p">=</span> <span class="p">(</span><span class="n">elem</span><span class="p">(</span><span class="n">nodeStar</span><span class="p">(</span><span class="mi">1</span><span class="p">,:),</span><span class="mi">3</span><span class="p">)</span> <span class="o">==</span> <span class="n">elem</span><span class="p">(</span><span class="n">nodeStar</span><span class="p">(</span><span class="mi">4</span><span class="p">,:),</span><span class="mi">2</span><span class="p">));</span>
<span class="n">iy</span> <span class="p">=</span> <span class="p">(</span><span class="n">elem</span><span class="p">(</span><span class="n">nodeStar</span><span class="p">(</span><span class="mi">2</span><span class="p">,:),</span><span class="mi">2</span><span class="p">)</span> <span class="o">==</span> <span class="n">elem</span><span class="p">(</span><span class="n">nodeStar</span><span class="p">(</span><span class="mi">3</span><span class="p">,:),</span><span class="mi">3</span><span class="p">));</span>
<span class="c">% nodeStar(:,ix &amp; iy)  = nodeStar([1 2 3 4],ix &amp; iy);</span>
<span class="n">nodeStar</span><span class="p">(:,</span><span class="n">ix</span> <span class="o">&amp;</span> <span class="o">~</span><span class="n">iy</span><span class="p">)</span> <span class="p">=</span> <span class="n">nodeStar</span><span class="p">([</span><span class="mi">1</span> <span class="mi">3</span> <span class="mi">2</span> <span class="mi">4</span><span class="p">],</span><span class="n">ix</span> <span class="o">&amp;</span> <span class="o">~</span><span class="n">iy</span><span class="p">);</span>
<span class="n">nodeStar</span><span class="p">(:,</span><span class="o">~</span><span class="n">ix</span> <span class="o">&amp;</span> <span class="n">iy</span><span class="p">)</span> <span class="p">=</span> <span class="n">nodeStar</span><span class="p">([</span><span class="mi">1</span> <span class="mi">4</span> <span class="mi">2</span> <span class="mi">3</span><span class="p">],</span><span class="o">~</span><span class="n">ix</span> <span class="o">&amp;</span> <span class="n">iy</span><span class="p">);</span>
<span class="c">% nodeStar(:,~ix &amp; ~iy)= nodeStar([1 4 3 2],~ix &amp; ~iy);</span>
<span class="c">%%</span>
<span class="c">% We label the local indices of nodes in the star in the following figure.</span>
<span class="n">figure</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="n">node1</span> <span class="p">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">;</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">;</span> <span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">;</span> <span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">;</span> <span class="mi">0</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">];</span>
<span class="n">elem1</span> <span class="p">=</span> <span class="p">[</span><span class="mi">1</span> <span class="mi">4</span> <span class="mi">2</span><span class="p">;</span> <span class="mi">1</span> <span class="mi">3</span> <span class="mi">4</span><span class="p">;</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">5</span><span class="p">;</span> <span class="mi">1</span> <span class="mi">5</span> <span class="mi">3</span><span class="p">];</span>
<span class="n">showmesh</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="n">elem1</span><span class="p">);</span> <span class="n">findelem</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="n">elem1</span><span class="p">);</span> <span class="n">findnode</span><span class="p">(</span><span class="n">node1</span><span class="p">);</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">

<div class="prompt"></div>




<div class="output_png output_subarea ">
<img src="
B3RJTUUH4QgJBysEKOZJOQAAACR0RVh0U29mdHdhcmUATUFUTEFCLCBUaGUgTWF0aFdvcmtzLCBJ
bmMuPFjdGAAAACJ0RVh0Q3JlYXRpb24gVGltZQAwOS1BdWctMjAxNyAxNTo0MzowNMlfuLMAACAA
SURBVHic7d1/dJTVnfjxTyDyY7VhRGtbYHQQ2orpno2tlSYWMrC1RawCgkEpYiJi3R53D57gHx57
CrFbzp5dEPBb9/gFK8Ha3UNQfthz8AfdMqmVCEpF11iqAo878q1ClSEhBTFhvn/c7BAmk5nJZJ7n
3vs879fhj8kzl+HmerzvPDNPZkqSyaQAAKDbIN0TAABAhCABAAxBkAAARiBIAAAjECQAgBEIEgDA
CAQJAGAEggQAMAJBAgAYgSABAIxAkAAARiBIAAAjECQAgBEIEgDACAQJAGAEggQAMAJBAgAYgSAB
AIxAkAAARiBIAAAjECRAp/Xr199444033njjjh07dM8F0KxU9wSA4Nq7d+8999xz+vRpEZk5c6bu
6QCacYYE6NHW1jZ37lxVIwBCkABdFi1adODAAd2zAAxCkAANHnvssaampmHDhi1YsED3XABT8BoS
4LU33njjvvvuE5E1a9acOHFC93QAU3CGBLjLcZyeX544caKmpubUqVO33nrr3XffrWlSgIkIEuAW
x3GmTJkyduzYkpKSKVOmqDLdc88977zzzvjx49euXat7goBZeMoOcEtdXV0sFlO3Y7FYXV3d7bff
/qtf/Wro0KFNTU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KUCjU80Hc
nidgMoIEFEeeTfro7b+oGw899NADDzzg1ewAC3BRA1A0+Vzj4LTE1Y158+Z5NS/ADgQJKKbsTUrE
215f3yoiZWVl+/fvr6qqGjFixBVXXHHXXXcdOXLE88kCZuEqO6D4el53l7rKTl3hPWjQoIMHDw4e
PLirq6vnX/nSl7700ksvjRs3TtOUAf0IEuAK1aRE5zH1HF2kMix/Hrxu3bobbrjh9OnTIrJw4cLp
06f/5S9/Wb58+fvvvy8is2bN2rx5s+Z5A/oQJMAtU6ZMicViqS+j0eizzz7b2NgoIqNHj7755pvV
8UOHDk2YMOHTTz8VkWPHjvW87g4IFIIEuKWkpCTtSF//u02aNOn3v/+9iLS0tHzrW99yfWaAkbjs
G3CF4zi9D27btu348eMicvXVV1955ZWp46lQDR061JPZASbiDAlwS++n7ObMmXPvvfeKyLXXXqtO
iUTk4MGDEyZMOH369LBhw9rb20tL+TERAcVl34Bb1q9fX1tbq25Ho9GdO3dOnTp10KBBIvLyyy8v
WLDghRde2LRp03e/+111mcOdd95JjRBknCEB7nIcp+d7Aq1YseL+++/vPexrX/vanj17hg8f7t3M
AMNwhgS4K+0d6pYsWbJx48aeLyANGzasvr5+9+7d1AgBxxkSoMeRI0cOHjwYCoW+/OUvDx48WPd0
AP0IEgDACDxlBwAwAkECABiBIAEAjECQAABGIEgAACMQJACAEQgSAMAIBAkA3HMoEwAAAJ9JREFU
YASCBAAwAkECABiBIAEAjECQAABGIEgAACMQJACAEQgSAMAIBAkAYASCBAAwAkECABiBIAEAjECQ
AABGIEgAACMQJACAEQgSAMAIBAkAYASCBAAwAkECABiBIAEAjECQAABGIEgAACMQJACAEQgSAMAI
BAkAYASCBAAwAkECABiBIAEAjECQAABGIEgAACMQJACAEQgSAMAI/x+apbG7WG4p5QAAAABJRU5E
rkJggg==
"
>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Then t1 and t2 are merged to a big triangle and stored in t1 and
similarly t3 and t4 are merged together and stored in t3. Elements t2 and t4 will be removed later on.</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[20]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-matlab"><pre><span></span><span class="n">t1</span> <span class="p">=</span> <span class="n">nodeStar</span><span class="p">(</span><span class="mi">1</span><span class="p">,:);</span> 
<span class="n">t2</span> <span class="p">=</span> <span class="n">nodeStar</span><span class="p">(</span><span class="mi">2</span><span class="p">,:);</span> 
<span class="n">t3</span> <span class="p">=</span> <span class="n">nodeStar</span><span class="p">(</span><span class="mi">3</span><span class="p">,:);</span>
<span class="n">t4</span> <span class="p">=</span> <span class="n">nodeStar</span><span class="p">(</span><span class="mi">4</span><span class="p">,:);</span>
<span class="c">% p1 = elem(t1,1); </span>
<span class="n">p2</span> <span class="p">=</span> <span class="n">elem</span><span class="p">(</span><span class="n">t1</span><span class="p">,</span><span class="mi">3</span><span class="p">);</span> 
<span class="n">p3</span> <span class="p">=</span> <span class="n">elem</span><span class="p">(</span><span class="n">t2</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span> 
<span class="n">p4</span> <span class="p">=</span> <span class="n">elem</span><span class="p">(</span><span class="n">t1</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span> 
<span class="n">p5</span> <span class="p">=</span> <span class="n">elem</span><span class="p">(</span><span class="n">t3</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span>
<span class="n">elem</span><span class="p">(</span><span class="n">t1</span><span class="p">,:)</span> <span class="p">=</span> <span class="p">[</span><span class="n">p4</span> <span class="n">p2</span> <span class="n">p3</span><span class="p">];</span> 
<span class="n">elem</span><span class="p">(</span><span class="n">t2</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span> <span class="p">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="n">elem</span><span class="p">(</span><span class="n">t3</span><span class="p">,:)</span> <span class="p">=</span> <span class="p">[</span><span class="n">p5</span> <span class="n">p3</span> <span class="n">p2</span><span class="p">];</span> 
<span class="n">elem</span><span class="p">(</span><span class="n">t4</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span> <span class="p">=</span> <span class="mi">0</span><span class="p">;</span>
</pre></div>

</div>
</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>For boundary good nodes, there is only one case.</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[23]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-matlab"><pre><span></span><span class="n">figure</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="n">node1</span> <span class="p">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">;</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">;</span> <span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">;</span> <span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">];</span>
<span class="n">elem1</span> <span class="p">=</span> <span class="p">[</span><span class="mi">1</span> <span class="mi">4</span> <span class="mi">2</span><span class="p">;</span> <span class="mi">1</span> <span class="mi">3</span> <span class="mi">4</span><span class="p">];</span>
<span class="n">showmesh</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="n">elem1</span><span class="p">);</span> <span class="n">findelem</span><span class="p">(</span><span class="n">node1</span><span class="p">,</span><span class="n">elem1</span><span class="p">);</span> <span class="n">findnode</span><span class="p">(</span><span class="n">node1</span><span class="p">);</span>
<span class="p">[</span><span class="n">ii</span><span class="p">,</span><span class="n">jj</span><span class="p">]</span> <span class="p">=</span> <span class="nb">find</span><span class="p">(</span><span class="n">t2v</span><span class="p">(:,</span><span class="n">bdGoodNode</span><span class="p">));</span>
<span class="n">nodeStar</span> <span class="p">=</span> <span class="nb">reshape</span><span class="p">(</span><span class="n">ii</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="nb">length</span><span class="p">(</span><span class="n">bdGoodNode</span><span class="p">));</span>
<span class="n">t1</span> <span class="p">=</span> <span class="n">nodeStar</span><span class="p">(</span><span class="mi">1</span><span class="p">,:);</span> 
<span class="n">t2</span> <span class="p">=</span> <span class="n">nodeStar</span><span class="p">(</span><span class="mi">2</span><span class="p">,:);</span>
<span class="n">p1</span> <span class="p">=</span> <span class="n">elem</span><span class="p">(</span><span class="n">t1</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span> 
<span class="n">p2</span> <span class="p">=</span> <span class="n">elem</span><span class="p">(</span><span class="n">t1</span><span class="p">,</span><span class="mi">3</span><span class="p">);</span> 
<span class="n">p3</span> <span class="p">=</span> <span class="n">elem</span><span class="p">(</span><span class="n">t2</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span> 
<span class="n">p4</span> <span class="p">=</span> <span class="n">elem</span><span class="p">(</span><span class="n">t1</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span>
<span class="n">elem</span><span class="p">(</span><span class="n">t1</span><span class="p">,:)</span> <span class="p">=</span> <span class="p">[</span><span class="n">p4</span> <span class="n">p2</span> <span class="n">p3</span><span class="p">];</span> 
<span class="n">elem</span><span class="p">(</span><span class="n">t2</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span> <span class="p">=</span> <span class="mi">0</span><span class="p">;</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">

<div class="prompt"></div>




<div class="output_png output_subarea ">
<img src="
B3RJTUUH4QgJBy8n7u39TwAAACR0RVh0U29mdHdhcmUATUFUTEFCLCBUaGUgTWF0aFdvcmtzLCBJ
bmMuPFjdGAAAACJ0RVh0Q3JlYXRpb24gVGltZQAwOS1BdWctMjAxNyAxNTo0NzozOROhAJoAABcx
SURBVHic7d1/jJz1feDx78YbbA5jHKqgHPaGNViNFFeqObUBnIDXJL4ktIAJjaE0EG+IExRVkYnp
H1WiYDenqn/EGHKhoigCkx89xVwApxINIIVxICxGcc7Q+iAJvky09R3BOKzXLLgUe+6PxyzL/vbu
zDyf53leL/mP8ezj4cN+Z5/3PjPPzHQ0Go0EAHl7R94DAEBKggRAEIIEQAiCBEAIggRACIIEQAiC
BEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIE
QAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRA
CIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAI
ggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiC
BEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIEQAiCBEAIggRACIIE
QAiCBEAIggRACIIEQAiCBEAIggRACIIEebr77rsvvfTSSy+99JFHHsl7FshZZ94DQHXt3r37hhtu
eP3111NKa9asyXscyJkjJMjH4ODgVVddldUISIIEeVm/fv2+ffvyngICESTIwR133LF9+/Z58+Zd
d911ec8CUXgOCdrt6aefvvHGG1NKt9122yuvvJL3OBCFIyRorXq9PvKvr7zyytq1a48cOXL11Vd/
7nOfy2koiEiQoFXq9fqqVauWLFnS0dGxatWqrEw33HDDL3/5y6VLl9555515DwixeMgOWqW3t7dW
q2WXa7Vab2/vtdde+73vfW/u3Lnbt28/9dRTc50OwuloNBp5zwDl1NHRMeqaT37yk/fee+/JJ5+8
aNGi7JqXX3754MGDKaUzzjhjwYIFt9122yWXXNLuQSEGR0jQEqOeOsoMDQ2llF577bXnn39+1Jde
fPHFF1988fDhw22YDWISJGiJ7u7unp6e4YfsUko9PT1r1qxZvHjxyM2eeeaZJ598MqW0cuXK973v
feecc06b54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65R1yZx3F5YglUQpa5SJv4MrpXIvmSbFJEhlELxGKaXalidmtmvLDO/gsoe/
aIPSL5kmBSRIhRe/Rnu2781O0JrZri1z882ppyft2b63/kR/0yZjAhVZMk2KRpCKLX6NUkrZ/mjd
uik2++u/TitWpKeemnCD7OSuel/QvVuZTLlk99yTVqxICxakpUvTX/1VOnRo/M3iL5kmhSJIBVaI
GqU390crV062zVNPpdtuS319E+7ahm9h5KthaJHJl+xv/zatW5f6+tLhw2nfvvT1r6fLLktHj46z
ZSGWTJPiEKSiKkqNUkrZ09oT/bp9663pyivThRem116b4nayc3QH+gdjPk9eJpMs2e9+l/7u71JK
adOmNDCQvvGNlFL6yU/Sj388zsZFWTJNCkKQCqlANcp+O57kwZ9t29J996XXX5/6prq7jz8ENNA/
8WEUszb5kv385+nw4XT66enLX06nnZb+8i/T4sUppfQv/zLOxgVaMk2KQJCKp0A1Sm8+GzHJCxBv
uSXdd1+6775p3Vq2d6tt6WvCZExg8iXr6Egf/3j6i79InZ0ppfTGG2loKKWUFi0af/sCLZkm5c67
fRdMsWo07KyzJvzSxRef8O3EfP1/yUy0ZB/+cPrwh49fbjTShg3p5ZfTwoUTrmOxlsz7gufLEVKR
FLFG2ZMHv/lNc26tWbfDJKa5ZAcOpD/90/T3f59OOinddVd697vH36xwS+Y4KUeCVBhFrFFKqWfj
BSm97d2gZyO7nWJ9BwpnOkvW15fOPTc9+GBavDg98ki64ooJtyzikmlSXgSpGApao5TSwq7TUkrN
+rk+vne7oGDfhGKZcskefTR95CNp//708Y+np59OF1002a0VdMk0KReCVADFrVF683Pbsk8lmKVt
247fYFGekCioyZdsaChdc0169dX0J3+S/umf0umnT3ZThV4yTWo/QYqu0DXKdK9YnFK6557Z3s7O
nSkV8HftIppkyb773fTCCyml9M//nObOTZ2dx/9s3DjOxkVfMk1qM0EKrQQ1Sm/uj2Z/hFTEZyMK
apIle+aZ4xeOHUtHj77159ixcTYuwZJpUjsJUlzlqFFKaWHXacvXLqvX0+bNk23Wa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c5qT0Htjwo3pf
f3a53tf/wIYf5TsP1bSwa8HAGy+P3Cv29vaO3GDp0qXf+c53Nm/e3NXVdejQoc985jPr16/PYdBS
vg6po6Nj1DU9G4+fyPBvP/9//+cnvzl2tJFSetdZp73vv56TndcArVDbMvoVHsN3xcye7+8d+LfB
lNK5V//BaYtObd9kVMzYu+Krr776+uuvp5Tmz58/Z86c7Mr9+/d3dXU1Go1TTjnlpZdemjdvXpvn
LNtzSOOeUtJz6kcbjcZDDz30/JP1lFJnZ+fq1avPO++8Ns9G1dTSmCCd+tGRf/31nP87kAZTSuf+
pw+899T3tm8yKmbsXfFLX/pS9tLMHTt2XHbZZdmVixYtOvPMM/fv3z80NLR79+4PfvCD7R60UTo9
PT0j/wd7enoajcbwC49POeWUn/70p3nPSCWMe1ccaeXKldmXHn/88VwmpCLG3hXvueee7PJ11103
vNlTTz01vM3BgwfbP2cJH7Kr1+ubN2/etm1bSqmnp+fRRx996aWXli5deujQoZTS+eeff/7554/6
J1/84heXLFnS/lEpt7F3xVEb9PT07Ny5M6X0+OOP5/DbKJUx9q64f//+97///dlLkTZs2HDllVc+
/fTTt99++7PPPptS+sAHPrBr1672z1nCIGVGnuC4Y8eONWvWTLLxY4899qEPfagdY1E9I++KowgS
7TTqrvitb31r3JMX3vWud/3sZz87++yz2zfZm0p4ll1m5Pd97969+Q1C1U35HpfQHqPuip/97Gcf
eeSRZcuWDV8zZ86cT33qU7t3786lRqnER0gATMfAwMAvfvGL+fPnL126dO7cPE88FiQAQijtQ3YA
FIsgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQ
giABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCC
IAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIg
ARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiAB
EIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQ
giABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCC
IAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIgARCCIAEQgiABEIIg
ARCCIAEQwv8HFbOUHDF/IvUAAAAASUVORK5CYII=
"
>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Clean-and-Shift-Node-and-Elem-Matrices">Clean and Shift Node and Elem Matrices<a class="anchor-link" href="#Clean-and-Shift-Node-and-Elem-Matrices">&#182;</a></h2><p>The empty rows in node and elem matrices should be relased for the
efficent usage of meomory.</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[25]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-matlab"><pre><span></span><span class="n">elem</span><span class="p">((</span><span class="n">elem</span><span class="p">(:,</span><span class="mi">1</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">),:)</span> <span class="p">=</span> <span class="p">[];</span>
<span class="n">isGoodNode</span> <span class="p">=</span> <span class="n">false</span><span class="p">(</span><span class="n">N</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span>
<span class="n">isGoodNode</span><span class="p">(</span><span class="n">intGoodNode</span><span class="p">)</span> <span class="p">=</span> <span class="n">true</span><span class="p">;</span>
<span class="n">isGoodNode</span><span class="p">(</span><span class="n">bdGoodNode</span><span class="p">)</span> <span class="p">=</span> <span class="n">true</span><span class="p">;</span>
<span class="n">node</span><span class="p">(</span><span class="n">isGoodNode</span><span class="p">,:)</span> <span class="p">=</span> <span class="p">[];</span>
</pre></div>

</div>
</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>Note that the indices of nodes in the coarsened mesh is changed while
elem still use the indices in the fine mesh. We build the indices map
between the fine grid to the coarse grid. For example, <code>indexMap(10) = 6</code>
means the 10-th node in the fine grid  is now the 6-th node in the coarse
one.</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[27]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-matlab"><pre><span></span><span class="n">indexMap</span> <span class="p">=</span> <span class="nb">zeros</span><span class="p">(</span><span class="n">N</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span>
<span class="n">indexMap</span><span class="p">(</span><span class="o">~</span><span class="n">isGoodNode</span><span class="p">)=</span> <span class="mi">1</span><span class="p">:</span><span class="nb">size</span><span class="p">(</span><span class="n">node</span><span class="p">,</span><span class="mi">1</span><span class="p">);</span>
<span class="n">elem</span> <span class="p">=</span> <span class="n">indexMap</span><span class="p">(</span><span class="n">elem</span><span class="p">);</span>
</pre></div>

</div>
</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>In the application to adaptive finite element methods, we will remove
 good-to-coraen nodes whose star are marked for coarsening.</p>
<p>In the application to multigrid methods, we will record all neighboring
nodes in the nodal star of good nodes; see the functoin: <code>uniformcoarsen</code>.</p>
<p>The 3-D coarsening algorithm is slightly complicated than the 2-D case.</p>

</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Aditional-data-structure">Aditional data structure<a class="anchor-link" href="#Aditional-data-structure">&#182;</a></h2><ul>
<li><code>bdFlag</code> stores information on boundary conditions. It is updated as</li>
</ul>

</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p><code>bdFlag(t1,:) = [bdFlag(t1,2) bdFlag(t2,1) bdFlag(t1,1)];
bdFlag(t3,:) = [bdFlag(t3,2) bdFlag(t4,1) bdFlag(t3,1)];
bdFlag(t5,:) = [bdFlag(t5,2) bdFlag(t6,1) bdFlag(t5,1)];
bdFlag((elem(:,1) == 0),:) = [];</code></p>

</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<ul>
<li><code>tree(:,1:3)</code> stores the binary tree of the coarsening. <code>tree(:,1)</code> is the index of parent element in the coarsened mesh and <code>tree(:,2:3)</code> are two children indices in the original mesh.</li>
</ul>

</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p><code>tree = zeros(NTdead,3,'uint32');
tree(1:NTdead,1) = [t1'; t3'; t5(idx)'];
tree(1:NTdead,2) = [t1'; t3'; t5(idx)'];
tree(1:NTdead,3) = [t2'; t4'; t6(idx)'];</code></p>

</div>
</div>
</div>
    </div>
  </div>
</body>

 


</html>
